<!DOCTYPE HTML>
{% load i18n static main_tag %}
{% get_current_language as LANGUAGE_CODE %}
<html>
<head>
    <title>{% block title %}{{ order_info.order_code }}-Quotation{% endblock %}</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="{% static 'main/favicon.ico' %}">
    <meta name="keywords" content="">
    <style type="text/css">
        html {
            width: 100%;
        }

        body {
            font-family: 'Open Sans', sans-serif;
            font-size: 13px;
            width: 100%;
            text-align: left;
        }

        td.logo {
          width: 140px;
        }

        .page {
            width: 660px;
            margin: 0 auto;
            background-color: #ffffff;
            padding: 30px 40px;
        }

        .container {
            width: 100%;
        }

        h2 {
            text-align: center;
            font-size: 30px;
        }

        th {
            font-size: 14.5px;
        }

        table, tr, th, td {
            padding: 0;
            margin: 0;
        }

        table {
            width: 100%;
            border-collapse:collapse;
            /* background-color: #b6306e; */
            /* width: 660px; */
        }

        table.list_container tr.list_container {
            border: solid black;
            border-width:1px 0;
        }

        table.equipment_list tbody tr.list_header th, table.equipment_list_contract tbody tr.list_header th{
            background-color: #63B8FF;
            text-align: center;
        }

        table.equipment_list_contract th, table.equipment_list_contract td {
            border: 1px solid black;
            padding: 5px;
        }

        table.equipment_list td, table.equipment_list th, table.other_cost th, table.other_cost td {
            border: solid black;
            border-width: 0 1px;
            padding: 5px;
        }

        table.equipment_list tr.equipment_list_title {
            border: solid black;
            border-width:1px 0;
        }

        table.other_cost tbody tr {
            border: solid black;
            border-width:1px 0;
        }

        table.summary th, table.summary td {
            border: 1px solid black;
            padding: 5px;
        }

        table.summary thead th {
            text-align: center;
        }

        table.main_footer td {
            text-align: center;
        }

        table.total_cost td, table.total_cost th {
            border-width: 1px;
            padding: 5px;
        }

        table.notes td, table.client td, table.client th {
            padding: 5px;
        }

    </style>{% if request.GET.v == 'page' %}
    <link href="{% static 'main/css/main.css' %}" rel="stylesheet">{% else %}
    <link href="{% static 'main/css/main-pdf.css' %}" rel="stylesheet">{% endif %}
</head>
<body>
    <div class="page">
        <div class="container">
            {% block page_header %}{% include 'main/page_header_quotation.html' %}{% endblock %}
            <h2>{% trans '项目报价' %}</h2>
            <table class="client">
                <tbody>
                    <tr>
                        <th style="width:80px;">{% trans '公司' %}:</th>
                        <td>{{ order_info.client.company|default_if_none:'' }}</td>
                        <th style="width:70px;">{% trans '联络人' %}:</th>
                        <td style="width:200px;">{{ order_info.client.name }}</td>
                    </tr>
                    <tr>
                        <th style="width:80px;">{% trans '地址' %}:</th>
                        <td rowspan="2" valign="top">{{ order_info.client.company_address|default_if_none:'' }}</td>
                        <th style="width:70px;">{% trans '手机号' %}:</th>
                        <td style="width:200px;">{{ order_info.client.mobile|default_if_none:'' }}</td>
                    </tr>
                    <tr>
                        <td></td>
                        {% if order_info.client.email %}<th style="width:70px;">E-mail:</th>
                        <td style="width:200px;">{{ order_info.client.email }}</td>{% else %}
                        <td></td>
                        <td style="width:200px;"></td>{% endif %}
                    </tr>
                </tbody>
            </table>
            <div class="row" style="height:20px;"></div>
            <table>
                <tbody>
                    <tr>
                        <th style="color:blue;text-align:right;">{% if LANGUAGE_CODE == 'en' %}Current{% else %}货币{% endif %}: {{ order_info.price_unit }}</th>
                    </tr>
                </tbody>
            </table>
            <table class="list_container">
                <thead>
                    <tr class="list_container">
                        <th>
                            <table class="equipment_list">
                                <tbody>
                                    <tr class="list_header">
                                        <th style="width:40px;">No.</th>
                                        <th>{% trans '项目' %}</th>
                                        <th style="width:90px;">{% if LANGUAGE_CODE == 'en' %}Price{% else %}单价{% endif %}</th>
                                        <th style="width:60px;">{% trans '数量' %}</th>
                                        <th style="width:90px;">{% if LANGUAGE_CODE == 'en' %}Sub-total{% else %}小计{% endif %}</th>
                                    </tr>
                                </tbody>
                            </table>
                        </th>
                    </tr>
                </thead>
                <tbody>{% for item in item_list %}
                    <tr class="list_container">
                        <td>
                            <table class="equipment_list">
                                <tbody>
                                    <tr class="equipment_list_title">
                                        <td style="width:40px;text-align:center;">{{ forloop.counter }}</td>
                                        <td>{{ item.equipment.equipment_code }} / {% if LANGUAGE_CODE == 'en' %}{{ item.equipment.equipment_en }}{% else %}{{ item.equipment.equipment_cn }}{% endif %}</td>
                                        <td style="width:90px;text-align:right;">{% if item.item_total_discount %}<span style="text-decoration:line-through;">{{ item.item_basic_price_auto }}</span><br>{{ item.item_price_each_auto }}{% else %}{{ item.item_basic_price_auto }}{% endif %}</td>
                                        <td style="width:60px;text-align:center;">{{ item.amount }} {% if LANGUAGE_CODE == 'en' %}{{ item.equipment.equipment_unit.equipment_unit_en }}{% else %}{{ item.equipment.equipment_unit.equipment_unit_cn }}{% endif %}</td>
                                        <td style="width:90px;text-align:right;">{% if item.item_total_discount %}<span style="text-decoration:line-through;">{{ item.item_total_price_auto }}</span><br>{{ item.item_final_price_auto }}{% else %}{{ item.item_total_price_auto }}{% endif %}</td>
                                    </tr>
                                    <tr class="equipment_list_desc">
                                        <td></td>
                                        <td><font size="2">{% if LANGUAGE_CODE == 'en' %}
                                            {{ item.equipment.equipment_para_en|safe|linebreaks }}
                                            {% if item.equipment_notes %}{{ item.equipment_notes|linebreaks }}{% endif %}
                                            {% else %}
                                            {{ item.equipment.equipment_para_cn|safe|linebreaks }}
                                            {% if item.equipment_notes %}{{ item.equipment_notes|linebreaks }}{% endif %}
                                            {% endif %}</font></td>
                                        <td colspan="3" valign="top" class="text-align:center;">
                                            {% if item.equipment.equipment_img %}
                                            <img src="{{ item.equipment.equipment_img|qiniu }}" width="240" alt="{{ item.equipment.equipment_en }}" />
                                            {% endif %}
                                        </td>
                                    </tr>
                                <tbody>
                            </table>
                        </td>
                    </tr>
                {% endfor %}
                </tbody>
            </table>
            <table>
                <thead>
                    <tr>
                        <th>
                        </th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>
                            <h2>{% trans '其他费用' %}</h2>
                            <table class="other_cost">
                                <tbody>
                                    <tr>
                                        <td style="width:30px;text-align:center;">1</td>
                                        <th colspan="2">{% trans '设备运输' %}</th>
                                        <td style="width:90px;text-align:right;">{{ order_info.transport_cost_auto|default_if_none:"N/A" }}</td>
                                        <td style="width:60px;text-align:center;">1 {% trans '系' %}</td>
                                        <td style="width:90px;text-align:right;">{{ order_info.transport_cost_auto|default_if_none:"N/A" }}</td>
                                    </tr>{% if order_info.transport_type %}
                                    <tr>
                                        <td style="text-align:center;"></td>
                                        <td colspan="2">{% if LANGUAGE_CODE == 'en' %}{{ order_info.transport_type.transport_en|linebreaks }}{% else %}{{ order_info.transport_type.transport_cn|linebreaks }}{% endif %}</td>
                                        <td colspan="3"></td>
                                    </tr>{% endif %}
                                    <tr>
                                        <td style="text-align:center;">2</td>
                                        <th colspan="2" align="left">{% trans '现场调试服务' %}</th>
                                        <td style="text-align:right;">{{ order_info.install_cost_auto|default_if_none:"N/A" }}</td>
                                        <td style="text-align:center;">1 {% trans '系' %}</td>
                                        <td style="text-align:right;">{{ order_info.install_cost_auto|default_if_none:"N/A" }}</td>
                                    </tr>{% if order_info.installation_desc %}
                                    <tr>
                                        <td style="text-align:center;"></td>
                                        <td colspan="2">{% if LANGUAGE_CODE == 'en' %}{{ order_info.installation_desc.installation_desc_en|linebreaks }}
                                        {% else %}{{ order_info.installation_desc.installation_desc_cn|linebreaks }}{% endif %}</td>
                                        <td colspan="3"></td>
                                    </tr>{% endif %}
                                    <tr>
                                        <td style="text-align:center;">3</td>
                                        <th colspan="2" align="left">{% trans '工程材料费用' %}</th>
                                        <td style="text-align:right;">{{ order_info.material_cost_auto|default_if_none:"N/A" }}</td>
                                        <td style="text-align:center;">1 {% trans '系' %}</td>
                                        <td style="text-align:right;">{{ order_info.material_cost_auto|default_if_none:"N/A" }}</td>
                                    </tr>{% if order_info.Installation_materials %}
                                    <tr>
                                        <td style="text-align:center;"></td>
                                        <td colspan="2">{% if order_info.installation_desc %}{% if LANGUAGE_CODE == 'en' %}
                                        {{ order_info.Installation_materials.install_m_en|linebreaks }}{% else %}
                                        {{ order_info.Installation_materials.install_m_cn|linebreaks }}{% endif %}{% endif %}</td>
                                        <td colspan="3"></td>
                                    </tr>{% endif %}
                                </tbody>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <h2>{% trans '合计' %}</h2>
                            <table class="summary">
                                <thead>
                                    <tr>
                                        <th><h4>{% trans '付款方式' %}</h4></th>
                                        <th><h4>{% trans '制造日期' %}</h4></th>
                                        <th colspan="2"><h3>{% trans '合计' %}</h3></th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr>
                                        <td style="text-align:center;">{% if order_info.order_pay_method %}{% if LANGUAGE_CODE == 'en' %}{{ order_info.order_pay_method.pay_method_en }}{% else %}{{ order_info.order_pay_method.pay_method_cn }}{% endif %}{% endif %}</td>
                                        <td style="width:90px;text-align:center;">{{ order_info.manufacturing_days|default_if_none:"N/A" }}{% if LANGUAGE_CODE == 'en' %} {% trans 'workdays' %}{% else %} {% trans '天' %}{% endif %}</td>
                                        <th style="width:120px;">{% if LANGUAGE_CODE == 'en' %}Total Price{% else %}总价:{% endif %}</th>
                                        <th style="width:90px;text-align:right;">{{ total_price_auto|default_if_none:"N/A"|floatformat:'2' }}</th>
                                    </tr>
                                </tbody>
                            </table>
                            <table class="total_cost">
                                <tbody>
                                    {% if total_discount > 0 %}
                                    <tr>
                                        <th align="left"></th>
                                        <th style="width:120px;">{% if LANGUAGE_CODE == 'en' %}Discount:{% else %}设备折扣:{% endif %}</th>
                                        <th style="width:90px;text-align:right;"><font color="red">-{{ total_discount_auto|floatformat:'2' }}</font></th>
                                    </tr>{% endif %}{% if extra_discount > 0 %}
                                    <tr>
                                        <th align="left"></th>
                                        <th style="width:120px;">{% if LANGUAGE_CODE == 'en' %}Extra Discount:{% else %}特批折扣:{% endif %}</th>
                                        <th style="width:90px;text-align:right;"><font color="red">-{{ extra_discount_auto|floatformat:'2' }}</font></th>
                                    </tr>{% endif %}{% if price_tax > 0 %}
                                    <tr>
                                        <th align="left"></th>
                                        <th style="width:120px;">{% if LANGUAGE_CODE == 'en' %}Tax {% else %}税 {% endif %}:</th>
                                        <th style="width:90px;text-align:right;">+{{ price_tax_auto|floatformat:'2' }}</th>
                                    </tr>{% endif %}
                                    <tr>
                                        <th align="left"></th>
                                        <th style="width:120px;">{% if LANGUAGE_CODE == 'en' %}Payment:{% else %}需支付:{% endif %}</th>
                                        <th style="width:90px;text-align:right;">{{ price_with_tax_auto|floatformat:'2' }}</th>
                                    </tr>
                                </tbody>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td>
                             <div class="row" style="height:40px;"></div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            {% trans '附属条款:' %}
                             <table class="notes">
                                <tbody>
                                    <tr style="height:30px;">
                                        <th align="left"></th>
                                    </tr>
                                    <tr>
                                        <td>{% if order_info.order_notes %}
                                                {% if LANGUAGE_CODE == 'en' %}
                                                    {{ order_info.order_notes.order_note_en|linebreaks }}
                                                {% else %}
                                                    {{ order_info.order_notes.order_note_cn|linebreaks }}
                                                {% endif %}
                                            {% endif %}
                                            {% if order_info.show_app_notes and order_info.app_notes %}
                                                {{ order_info.app_notes|linebreaks }}
                                            {% endif %}
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td>
                             <div class="row" style="height:30px;"></div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                             <table >
                                <tbody>
                                    <tr>
                                        <td></td>
                                        <th style="width:80px;">{% trans '销售人员:' %}</th>
                                        <td style="width:150px;">{{ order_info.salesman.name }}</td>
                                    </tr>
                                    <tr>
                                        <td></td>
                                        <th style="width:80px;">{% trans '联系电话:' %}</th>
                                        <td style="width:150px;">{{ order_info.salesman.mobile }}</td>
                                    </tr>
                                    <tr>
                                        <td></td>
                                        <th style="width:80px;">{% trans 'E-mail:' %}</th>
                                        <td style="width:150px;">{{ order_info.salesman.email }}</td>
                                    </tr>
                                </tbody>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td>
                             <div class="row" style="height:40px;"></div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
        <div class="footer" style="text-align:center;">
            <p></p>
        </div>
    </div>
    <script>
        function printsetup()  {
            web.execwb(8,1); // 打印页面设置
        }
        function printpreview()  {
            web.execwb(7,1); //打印页面预览
        }
        function copyToClipBoard()  {
            var clipBoardContent="";
            clipBoardContent+=document.title;
            clipBoardContent+="\n";
            clipBoardContent+=this.location.href;
            window.clipboardData.setData("Text",clipBoardContent);
            alert("复制成功，粘贴即可！");
        }
    </script>
</body>
</html>

